import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int a = in.nextInt();
        int b = in.nextInt();
        Map<Integer,Integer> hash = new HashMap<>();
        hash.put(1,1);
        hash.put(3,3);
        hash.put(5,5);
        hash.put(7,7);
        Map<Integer,Integer> hash1 = new HashMap<>();
        int count = 0;
        for (int i = a; i <= b; i++) {
            if(i < 10){
                continue;
            }else {
                int tmp = i;
                while ( tmp != 0){
                    int tmp1 = i % 10;
                    hash1.put(tmp1,hash1.getOrDefault(tmp1,0)+1);
                    tmp /= 10;
                }
                if(hash.containsKey(hash1)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}